﻿@using SmartStore.Web.Framework;
@model SmartStore.Clickatell.Models.SmsClickatellModel
@{
	Layout = "";
}

<div class="plugin-actions">
	<button type="submit" name="save" value="save" class="btn btn-warning">
		<i class="fa fa-check"></i>
		<span>@T("Admin.Common.Save")</span>
	</button>
</div>

<div class="plugin-configuration">
	<div>
		<div class="alert alert-info alert-dismissible">
			@Html.Raw(@T("Plugins.Sms.Clickatell.AdminInstruction"))
			<button class="close" data-dismiss="alert">&times;</button>
		</div>
	</div>
	<div class="mt-5">
		<a href="https://www.clickatell.com/" target="_blank">
			<img src="@Url.Content("~/Plugins/SmartStore.Clickatell/Content/branding.png")" alt="Clickatell" />
		</a>
	</div>
</div>

@{ Html.RenderAction("StoreScopeConfiguration", "Setting", new { area = "Admin" }); }

@Html.ValidationSummary(false)

@using (Html.BeginForm())
{
	<table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.Enabled)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.Enabled)
                @Html.ValidationMessageFor(model => model.Enabled)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.PhoneNumber)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.PhoneNumber)
                @Html.ValidationMessageFor(model => model.PhoneNumber)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ApiId)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ApiId)
                @Html.ValidationMessageFor(model => model.ApiId)
            </td>
        </tr>
        <tr>
            <td colspan="2">
				<div class="admin-config-group">
					<div class="title">@T("Plugins.Sms.Clickatell.SendTest.Hint")</div>
				</div>
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.TestMessage)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.TestMessage)
                @Html.ValidationMessageFor(model => model.TestMessage)
            </td>
        </tr>
		@if (Model.TestSmsResult.HasValue())
		{
			<tr>
				<td class="adminTitle">
					&nbsp;
				</td>
				<td class="adminData">				
					<div class="alert @(Model.TestSucceeded ? "alert-info" : "alert-danger") alert-dismissible">
						@Model.TestSmsResult @Model.TestSmsDetailResult
						<button class="close" data-dismiss="alert">&times;</button>
					</div>
				</td>
			</tr>
		}
        <tr>
			<td class="adminTitle">
				&nbsp;
			</td>
			<td class="adminData">
                <button type="submit" name="test-sms" value="test-sms" class="btn btn-secondary">
                    <i class="fa fa-envelope"></i>
					<span>@T("Plugins.Sms.Clickatell.SendTest")</span>
                </button>
            </td>
        </tr>
    </table>    
}

